using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Sys_Link - 友情链接 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ISysLink<T> :ModelBase<SysLink> where T : SysLink, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.LinkId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return LinkId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.LinkId=dy.LinkId;
           this.Title=dy.Title;
           this.WebUrl=dy.WebUrl;
           this.ImageUrl=dy.ImageUrl;
           this.Sno=dy.Sno;
        } 

        #region 定义属性

     
         /// <summary>
        /// linkId
        /// </summary>
        private String _LinkId = "";
      
        /// <summary>
        /// linkId
        /// </summary>
        public String LinkId
        {
            get 
            {
              return   (this._LinkId); 
            }

            set 
            {
                    _LinkId= value;  
            }
        }
       
     
         /// <summary>
        /// 链接名称
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 链接名称
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// URl
        /// </summary>
        private String _WebUrl = "";
      
        /// <summary>
        /// URl
        /// </summary>
        public String WebUrl
        {
            get 
            {
              return   (this._WebUrl); 
            }

            set 
            {
                    _WebUrl= value;  
            }
        }
       
     
         /// <summary>
        /// imgUrl
        /// </summary>
        private String _ImageUrl = "";
      
        /// <summary>
        /// imgUrl
        /// </summary>
        public String ImageUrl
        {
            get 
            {
              return   (this._ImageUrl); 
            }

            set 
            {
                    _ImageUrl= value;  
            }
        }
       
     
         /// <summary>
        /// 排序级别
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序级别
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(SysLink info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["LinkId"]!= DBNull.Value)
                  {
                  info.LinkId=row["LinkId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["WebUrl"]!= DBNull.Value)
                  {
                  info.WebUrl=row["WebUrl"].ToString();
                 }
                 
                  
                  if(row["ImageUrl"]!= DBNull.Value)
                  {
                  info.ImageUrl=row["ImageUrl"].ToString();
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, SysLink info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@LinkId", DbType.String,ParameterTool.GetObj( info._LinkId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@WebUrl", DbType.String,ParameterTool.GetObj( info._WebUrl )); 
            
             
                cn.AddInParameter(comm, "@ImageUrl", DbType.String,ParameterTool.GetObj( info._ImageUrl )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
        } 

    } 
} 